<template>
  <!-- 商品分类 弹框 -->
  <div class="dlalog">
    <div class="pop-up">
      <header>
        <span>创建产品分类</span>
        <svg-icon iconClass="x" @click="records"></svg-icon>
      </header>
      <main>
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="分类名称">
            <el-input v-model="form.name" placeholder="数码产品"></el-input>
          </el-form-item>
          <el-form-item label="父级">
            <el-select v-model="form.region" placeholder="每日新品">
              <el-option label="区域一">广东</el-option>
              <el-option label="区域二">湛江</el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="分类图标">
            <el-upload
              action=""
              list-type="picture-card"
              :on-preview="handlePictureCardPreview"
              :on-remove="handleRemove"
              class="upload"
            >
              <i class="el-icon-camera"></i>
            </el-upload>
            <el-dialog v-model="dialogVisible">
              <img width="100%" :src="dialogImageUrl" alt="" />
            </el-dialog>
          </el-form-item>
          <el-form-item label="排序">
            <el-input-number
              v-model="num"
              @change="handleChange"
              :min="1"
              :max="10"
              label="描述文字"
            ></el-input-number>
          </el-form-item>
          <el-form-item label="状态">
            <el-switch
              v-model="value"
              active-color="#148eff"
              inactive-color="#ff4949"
            >
            </el-switch>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">确定</el-button>
            <el-button @click="cancel">取消</el-button>
          </el-form-item>
        </el-form>
      </main>
    </div>
    
    <el-dialog title="收货地址" :visible.sync="dialogFormVisible">
  <el-form :model="form">
    <el-form-item label="活动名称" :label-width="formLabelWidth">
      <el-input v-model="form.name" autocomplete="off"></el-input>
    </el-form-item>
    <el-form-item label="活动区域" :label-width="formLabelWidth">
      <el-select v-model="form.region" placeholder="请选择活动区域">
        <el-option label="区域一" value="shanghai"></el-option>
        <el-option label="区域二" value="beijing"></el-option>
      </el-select>
    </el-form-item>
  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="dialogFormVisible = false">取 消</el-button>
    <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
  </div>
</el-dialog>


  </div>
</template>

<script>
  export default {
    data() {
      return {
        handleChange:'',
        recyleIsShow:'',
        handleRemove:'',
        deleteList:'',
        handlePictureCardPreview:'',
        value: "",
        num: 1,
        dialogImageUrl: "",
        dialogVisible: false,
        form: {
          name: "",
          region: "",
          date1: "",
          date2: "",
          delivery: false,
          type: [],
          resource: "",
          desc: "",
        },
      };
    },
    methods: {
      handleChange(value) {
        console.log(value);
      },
      handleRemove(file, fileList) {
        console.log(file, fileList);
      },
      onSubmit() {
        this.$emit("isShow", false);
      },
      records() {
        this.$emit("isShow", false);
      },
      cancel() {
        this.$emit("isShow", false);
      },
      handlePictureCardPreview(file) {
        this.dialogImageUrl = file.url;
        this.dialogVisible = true;
      },
    },
  };
</script>

<style lang="scss">
  .dlalog {
    width: 100%;
    height: 100%;
    background: rgba($color: #000000, $alpha: 0.8);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    .pop-up {
      width: 450px;
      height: auto;
      background: #fff;
      margin: 150px auto;
      border-radius: 8px;
      padding: 9px;
      header {
        height: 31px;
        border-bottom: 1px solid #f6f7f8;
        display: flex;
        justify-content: space-between;
        align-items: center;
        span {
          color: #c2c4c7;
          font-weight: bold;
          font-size: 14px;
        }
      }
      main {
        margin-top: 9px;
        .el-upload--picture-card {
          width: 40px;
          height: 40px;
          line-height: 40px;
          text-align: center;
        }
        .el-upload--picture-card i {
          font-size: 14px;
        }
        .el-select {
          width: 100%;
        }
      }
    }
  }
</style>
